const express = require('express')
const router = express.Router()
const articleCtrl = require('../controller/article')
const auth = require('../middleware/auth')
const articleValidator = require('../validator/article')
//List Articles
router.get('/', articleCtrl.listArticles)

//Get Article
router.get('/:articleId', articleValidator.getArticle, articleCtrl.getArticle)

//Create Article
router.post('/', auth, articleValidator.createArticle, articleCtrl.createArticle)

//update Article
router.put('/:articleId', auth, articleValidator.updateArticle, articleCtrl.updateArticle)

//Delete Article
router.delete('/:articleId',auth,articleValidator.deleteArticle,articleCtrl.deleteArticle)


router.post('/photo', auth, articleCtrl.sendPhoto)


router.post('/articlePhoto', auth, articleCtrl.articlePhoto)

module.exports = router
